package ar.com.spsolutions.splibrary.book;

public class BookCopyBuilder {

	private transient BookCopy toBuild;

	public static BookCopy createInstanceForTest() {
		final Book book = BookBuilder.createInstanceForTest();
		return new BookCopyBuilder()//
				.withBook(book)//
				.withCopyId("id de la copia")//
				.build();
	}

	public BookCopyBuilder() {
		this.toBuild = new BookCopy();
	}

	public BookCopyBuilder withCopyId(final String value) {
		this.getToBuild().setCopyId(value);
		return this;
	}

	public BookCopyBuilder withBook(final Book value) {
		this.getToBuild().setBook(value);
		return this;
	}

	public BookCopyBuilder withRental(final LoanBook value) {
		this.getToBuild().setLoan(value);
		return this;
	}

	public BookCopy build() {
		final BookCopy temp = this.getToBuild();
		this.toBuild = new BookCopy();
		return temp;
	}

	private BookCopy getToBuild() {
		return this.toBuild;
	}
}
